﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public partial class DataContext
    {
        public List<KhachHang> GetListKhachHang()
        {
            return db.KhachHangs.ToList();
        }
        public KhachHang GetKhachHangById(Guid id)
        {
            return db.KhachHangs.Where(c => c.MaKH == id).FirstOrDefault();
        }
        public void DeleteKhachHang(KhachHang cthd)
        {
            db.Entry(cthd).State = EntityState.Deleted;
            db.SaveChanges();
        }
        public void InsertKhachHang(KhachHang cthd)
        {
            db.Entry(cthd).State = EntityState.Added;
            db.SaveChanges();
        }
        public void UpdateKhachHang(KhachHang cthd)
        {
            db.Entry(cthd).State = EntityState.Modified;
            db.SaveChanges();
        }
    }
}
